package io.github.eiot.json.deserializer;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import io.github.eiot.codec.Hex;

import java.io.IOException;

/**
 * created by wang007 on 2025/9/27
 */
public class HexDeserializer extends JsonDeserializer<Hex> {

    public static final HexDeserializer INSTANCE = new HexDeserializer();

    @Override
    public Hex deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JacksonException {
        return Hex.from(p.getText());
    }
}
